package com.fand.stater.autoconfigure;

import javax.annotation.Resource;

import com.fand.stater.handler.SysUserESIndexRecordHandler;
import com.fand.stater.handler.SysUserOperateRecordHandler;
import com.fand.stater.interceptor.IndexUserInfoInterceptor;
import com.fand.stater.interceptor.UserInfoInterceptor;
import com.fand.stater.interceptor.UserOperateInterceptor;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Author: zhangjiabin
 * Email: javaboyok@163.com
 * CreateDate: 2021/6/26
 * Version: 1.0
 */
@Configuration
public class WebMvcAutoConfiguratioon implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new IndexUserInfoInterceptor(sysUserESIndexRecordHandler()));
        registry.addInterceptor(new UserOperateInterceptor(sysUserOperateRecordHandler()));
    }

    @Bean
    public SysUserESIndexRecordHandler sysUserESIndexRecordHandler(){
        return new SysUserESIndexRecordHandler();
    }

    @Bean
    public SysUserOperateRecordHandler sysUserOperateRecordHandler(){
        return new SysUserOperateRecordHandler();
    }
}
